package com.briup.recognition.web.controller;

import com.briup.recognition.bean.UserRole;
import com.briup.recognition.service.IUserRoleService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/userrole")
public class UserRoleController {

    @Autowired
    private IUserRoleService userRoleService;

    @GetMapping("query")
    public Message query(){
        List<UserRole> list= userRoleService.query();
        return MessageUtil.success(list);
    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(UserRole userRole){
        userRoleService.saveOrUpdate(userRole);
            return MessageUtil.success("操作成功");

    }
    @DeleteMapping("deleteById")
    public Message deleteById(Long id){
        userRoleService.deleteById(id);
        return MessageUtil.success("删除成功");
    }
}
